package com.csnf.controller;

import com.csnf.dto.ResponseObject;
import com.csnf.entity.Admin;
import com.csnf.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user")
public class LoginController {
    @Autowired
    private LoginService loginService;
    @RequestMapping(value = "/login",method = RequestMethod.POST)
    public ResponseObject login(@RequestBody Admin admin){
        int loginFlag = loginService.login(admin);
        if(loginFlag==1){
            return ResponseObject.success("success");
        }else{
            return ResponseObject.success("error");
        }
    }
}
